using System.Collections.Generic;

namespace Common.Security
{
    /// <summary>
    /// 
    /// </summary>
    public class SimplePrincipal : System.Security.Principal.IPrincipal
    {
        private SimpleIdentity _Identity;
        private List<string> _Roles;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="identity"></param>
        public SimplePrincipal(SimpleIdentity identity)
        {
            this._Identity = identity;
            this._Roles = this.TryGetRoles();
        }

        #region IPrincipal Members

        /// <summary>
        /// 
        /// </summary>
        public System.Security.Principal.IIdentity Identity
        {
            get
            {
                return this._Identity;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        public bool IsInRole(string role)
        {
            if (this._Roles.Contains(role))
                return true;
            else
                return false;
        }

        #endregion

        #region authorization
        private List<string> TryGetRoles()
        {
            List<string> roles = new List<string>();
            return roles;
        }
        #endregion
    }
}
